home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 24 / AACD 24.iso / AACD / Utilities / PdaLink / developer / include / libraries / pdalink.h next >
C/C++ Source or Header  |  2001-07-17  |  11KB  |  297 lines

  1. /*****************************************************************
  2. **                                                              **
  3. ** PdaLink Header File                                          **
  4. **                                                              **
  5. ******************************************************************
  6. **
  7. ** (C) 1998-2000 Richard Körber -- all rights reserved
  8. **
  9. *****************************************************************/
  10.  
  11. #ifndef LIBRARIES_PDALINK_H
  12. #define LIBRARIES_PDALINK_H
  13.  
  14. #ifndef EXEC_TYPES_H
  15. #include <exec/types.h>
  16. #endif
  17. #ifndef UTILITY_TAGITEM_H
  18. #include <utility/tagitem.h>
  19. #endif
  20.  
  21.  
  22.  
  23. /*--------------------------------------------------------------**
  24. **    Miscellaneous
  25. */
  26. #define PDALINK_NAME "pdalink.library"
  27.  
  28. #define PDALINKVERSION (2)
  29.  
  30.  
  31.  
  32. /*--------------------------------------------------------------**
  33. **    Tags
  34. */
  35. #define PLTAG_BASE          (0x8FEA0000)        /* Base for all TagItems */
  36. #define PLTAG_ErrorPtr      (PLTAG_BASE + 0x00) /* Pointer to LONG for error code result */
  37. #define PLTAG_SerialDevice  (PLTAG_BASE + 0x01) /* Device name */
  38. #define PLTAG_SerialUnit    (PLTAG_BASE + 0x02) /* Device unit nr. */
  39. #define PLTAG_SerialMaxRate (PLTAG_BASE + 0x03) /* Maximum baud rate */
  40. #define PLTAG_SerialTimeout (PLTAG_BASE + 0x04) /* Timeout (seconds) */
  41. #define PLTAG_AbortMask     (PLTAG_BASE + 0x05) /* Signal mask for abortion, e.g. CTRL-C */
  42.  
  43.  
  44. /*--------------------------------------------------------------**
  45. **    Desktop Link Protocol
  46. */
  47. /* System Time */
  48. struct DLP_SysTime
  49. {
  50.   UWORD year;                           /* Year */
  51.   UBYTE month;                          /* Month */
  52.   UBYTE day;                            /* Day */
  53.   UBYTE hour;                           /* Hour */
  54.   UBYTE minute;                         /* Minute */
  55.   UBYTE second;                         /* Second */
  56.   UBYTE pad;                            /* (always set to 0) */
  57. };
  58.  
  59. /* RAM/ROM card info */
  60. struct DLP_StorageInfo
  61. {
  62.   UWORD  cardVersion;                   /* Version */
  63.   struct DLP_SysTime date;              /* Creation date */
  64.   ULONG  ROMSize;                       /* Size of ROM */
  65.   ULONG  RAMSize;                       /* Size of RAM */
  66.   ULONG  RAMFree;                       /* Free RAM */
  67.   char   name[128];                     /* Name of the card */
  68.   char   manuf[128];                    /* Manufacturer of the card */
  69.   UBYTE  cardNo;                        /* Card No. */
  70.   UBYTE  more;                          /* BOOL: more cards? */
  71. };
  72.  
  73. /* System Info */
  74. struct DLP_SysInfo
  75. {
  76.   ULONG romVer;                         /* ROM Version */
  77.   ULONG locale;                         /* Localizion code */
  78.   UBYTE name[128];                      /* System name */
  79. };
  80.  
  81. /* User Info */
  82. struct DLP_UserInfo
  83. {
  84.   ULONG userID;
  85.   ULONG viewerID;
  86.   ULONG lastSyncPC;
  87.   struct DLP_SysTime successfulSync;
  88.   struct DLP_SysTime lastSync;
  89.   char  userName[128];
  90.   char  password[128];
  91. };
  92.  
  93. /* Netsync Info */
  94. struct DLP_NetSyncInfo
  95. {
  96.   UWORD lanSync;
  97.   char hostName[256];
  98.   char hostAddress[40];
  99.   char hostSubnetMask[40];
  100. };
  101.  
  102. /* Database Info */
  103. struct DLP_DBInfo
  104. {
  105.   UBYTE more;                           /* BOOL: more databases? */
  106.   UBYTE excludes;                       /* Exclude flags, see below */
  107.   UWORD flags;                          /* Entry flags, see below */
  108.   ULONG type;                           /* Type ID */
  109.   ULONG creator;                        /* Creator ID */
  110.   UWORD version;                        /* Version */
  111.   ULONG modnum;                         /* Modification Number */
  112.   struct DLP_SysTime createDate;        /* Creation date */
  113.   struct DLP_SysTime modifyDate;        /* Last modification */
  114.   struct DLP_SysTime backupDate;        /* Last backup */
  115.   UWORD index;                          /* Index */
  116.   UBYTE name[34];                       /* Entry name */
  117. };
  118.  
  119. /* GetDBInfo flags */
  120. #define DLPGDBF_RAM           (0x80)    /* List RAM entries only */
  121. #define DLPGDBF_ROM           (0x40)    /* List ROM entries only */
  122.  
  123. /* DBInfo excludes */
  124. #define DLPDBIE_EXCLUDESYNC   (0x80)    /* Exclude from Sync */
  125.  
  126. /* DBInfo flags */
  127. #define DLPDBIF_RESOURCE      (0x0001)  /* DB Resource (not a record) */
  128. #define DLPDBIF_READONLY      (0x0002)  /* Read only */
  129. #define DLPDBIF_APPINFODIRTY  (0x0004)  /* AppInfo has been modified */
  130. #define DLPDBIF_BACKUP        (0x0008)  /* Generic backup */
  131. #define DLPDBIF_NEWER         (0x0010)  /* Newer may replace older in open DB */
  132. #define DLPDBIF_RESET         (0x0020)  /* Reset after installation */
  133. #define DLPDBIF_OPEN          (0x8000)  /* Currently opened */
  134.  
  135. /* DB Attribute */
  136. #define DLPDBAT_DELETED       (0x80)    /* Deleted */
  137. #define DLPDBAT_DIRTY         (0x40)    /* Changed since last sync */
  138. #define DLPDBAT_BUSY          (0x20)    /* Currently locked */
  139. #define DLPDBAT_SECRET        (0x10)    /* Private entry */
  140. #define DLPDBAT_ARCHIVE       (0x08)    /* To be archived on next sync */
  141.  
  142. /* DB Open flags */
  143. #define DLPDBOF_READ          (0x80)    /* Open for reading */
  144. #define DLPDBOF_WRITE         (0x40)    /* Open for writing */
  145. #define DLPDBOF_EXCLUSIVE     (0x20)    /* Do not share */
  146. #define DLPDBOF_SECRET        (0x10)    /* Private entry */
  147. #define DLPDBOF_READWRITE     (0xC0)
  148.  
  149.  
  150.  
  151. /*--------------------------------------------------------------**
  152. **    Connection Management Protocol
  153. */
  154.  
  155. /* CMP structure */
  156. struct PL_CMP
  157. {
  158.   UBYTE  type;                          /* CMP message type */
  159.   UBYTE  flags;                         /* Some flags */
  160.   UWORD  version;                       /* Version code */
  161.   WORD   reserved;                      /* 0 for now */
  162.   ULONG  baudrate;                      /* Wakeup: maximum rate */
  163.                                         /* Init: connection rate */
  164. };
  165.  
  166. /* CMP Types */
  167. #define PLCMP_WAKEUP      (1)           /* Wakeup */
  168. #define PLCMP_INIT        (2)           /* Init connection */
  169. #define PLCMP_ABORT       (3)           /* Abort connection */
  170.  
  171. /* CMP Flags */
  172. #define PLCMPF_CHANGEBAUD (0x80)        /* Init: change baud rate */
  173.  
  174.  
  175.  
  176. /*--------------------------------------------------------------**
  177. **    Packet Assembly Disassembly Protocol
  178. */
  179.  
  180. /* PADP Header structure */
  181. struct PL_PADP_Header
  182. {
  183.   UBYTE  type;                          /* Type of Packet */
  184.   UBYTE  flags;                         /* Flags */
  185.   UWORD  size;                          /* Size of data */
  186. };                                      /* Data follows here */
  187.  
  188. /* PADP Types */
  189. #define PLPADP_DATA       (0x01)        /* Plain Data */
  190. #define PLPADP_WAKE       (0x101)       /* Wakeup, used by CMP */
  191. #define PLPADP_ACK        (0x02)        /* Acknowledge */
  192. #define PLPADP_TICKLE     (0x04)        /* Tickle */
  193. #define PLPADP_ABORT      (0x08)        /* Abort (PalmOS 2.0 only) */
  194.  
  195. /* PADP Flags */
  196. #define PLPADPF_FIRST     (0x80)        /* First packet */
  197. #define PLPADPF_LAST      (0x40)        /* Last packet */
  198. #define PLPADPF_MEMERROR  (0x20)        /* Receiver has not enough memory */
  199.  
  200.  
  201.  
  202. /*--------------------------------------------------------------**
  203. **    Serial Link Protocol
  204. */
  205.  
  206. /* SLP Header structure */
  207. struct PL_SLP_Header
  208. {
  209.   UBYTE  signature[3];                  /* (will be set by pdalink.library) */
  210.   UBYTE  destSocket;                    /* Destination Socket ID */
  211.   UBYTE  srcSocket;                     /* Source Socket ID */
  212.   UBYTE  pckType;                       /* Packet Type */
  213.   UWORD  dataSize;                      /* (will be set by pdalink.library) */
  214.   UBYTE  transID;                       /* Current transaction ID */
  215.   UBYTE  checksum;                      /* (calculated by pdalink.library) */
  216. };
  217.  
  218. /* SLP Socket IDs */
  219. #define PLSLPSOCK_DEBUG (0)             /* Debugger */
  220. #define PLSLPSOCK_CON   (1)             /* Console */
  221. #define PLSLPSOCK_RUI   (2)             /* Remote User Interface */
  222. #define PLSLPSOCK_DLP   (3)             /* Desktop Link Protocol */
  223.  
  224. /* SLP Packet Types */
  225. #define PLSLPTYPE_RDCP  (0)             /* Remote Debugger / Console */
  226. #define PLSLPTYPE_PADP  (2)             /* Packet Assembler Disassembler */
  227. #define PLSLPTYPE_LOOP  (3)             /* Loopback */
  228.  
  229.  
  230. /*--------------------------------------------------------------**
  231. **    Category Application Info
  232. */
  233.  
  234. /* Category AppInfo structure */
  235. struct PL_CategoryAppInfo
  236. {
  237.   UWORD  renamed;                       /* Bit array: renamed categories */
  238.   UBYTE  name[16][16];                  /* Array of Category names */
  239.   UBYTE  ID[16];                        /* Category IDs */
  240.   UBYTE  lastUniqueID;
  241.   UBYTE  pad[3];                        /* always 0 */
  242. };
  243.  
  244.  
  245. /*--------------------------------------------------------------**
  246. **    Error Codes
  247. */
  248.  
  249. /* PdaLink errors */
  250. #define PLERR_OKAY              (0)     /* No error occured */
  251. #define PLERR_NOMEM             (-1)    /* Not enough memory */
  252. #define PLERR_NORESOURCE        (-2)    /* A resource is allocated */
  253. #define PLERR_SERIAL            (-3)    /* Some serial error */
  254. #define PLERR_TIMEOUT           (-4)    /* Connection timeout */
  255. #define PLERR_CHECKSUM          (-5)    /* Data checksum error */
  256. #define PLERR_REMOTENOMEM       (-6)    /* Remote has not enough memory */
  257. #define PLERR_BADPACKET         (-7)    /* Got an unexpected packet */
  258. #define PLERR_NOTCOMPATIBLE     (-8)    /* Connection not compatible */
  259. #define PLERR_BADBAUD           (-9)    /* No fitting Baud rate found */
  260.                                         /* If you should get this one, try */
  261.                                         /* to lower PLTAG_SerialMaxRate. */
  262.                                         /* 9600 should work in any case, */
  263.                                         /* except you have a very wierd */
  264.                                         /* multi serial board. */
  265. #define PLERR_DOSERROR          (-10)   /* DOS error, see IoErr() */
  266. #define PLERR_OS2REQUIRED       (-11)   /* PalmOS2.0 or higher is required */
  267.                                         /* to use this function */
  268. #define PLERR_TOOLARGE          (-12)   /* Data buffer is too large (>64KB) */
  269. #define PLERR_ABORTED           (-13)   /* Aborted by abortion signal */
  270.  
  271. /* DLP errors */
  272. #define PLERR_GENERAL           (1)     /* General system error */
  273. #define PLERR_ILLEGALFCT        (2)     /* Illegal function */
  274. #define PLERR_DLPNOMEM          (3)     /* Out of memory */
  275. #define PLERR_INVPARAM          (4)     /* Invalid parameter */
  276. #define PLERR_NOTFOUND          (5)     /* Not found */
  277. #define PLERR_NONEOPEN          (6)     /* None opened */
  278. #define PLERR_ALREADYOPEN       (7)     /* Already opened */
  279. #define PLERR_TOOMANYOPEN       (8)     /* Too many are opened */
  280. #define PLERR_ALREADYEXIST      (9)     /* Already exists */
  281. #define PLERR_CANTOPEN          (10)    /* Can't open */
  282. #define PLERR_RECDELETED        (11)    /* Record deleted */
  283. #define PLERR_RECBUSY           (12)    /* Record busy */
  284. #define PLERR_UNSUPPORTED       (13)    /* Operation not supported */
  285. #define PLERR_READONLY          (15)    /* Read only */
  286. #define PLERR_NOSPACE           (16)    /* Not enough space */
  287. #define PLERR_EXCEEDED          (17)    /* Limit exceeded */
  288. #define PLERR_CANCELLED         (18)    /* Sync cancelled */
  289. #define PLERR_BADARG            (19)    /* Bad argument wrapper */
  290. #define PLERR_ARGMISSING        (20)    /* Argument is missing */
  291. #define PLERR_ARGSIZE           (21)    /* Bad argument size */
  292.  
  293.  
  294. #endif
  295. /****************************************************************/
  296.  
  297.